<template>
  <div class="centerpage">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="用户名">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="性别">
        <el-radio v-model="form.sex" label="0">女</el-radio>
        <el-radio v-model="form.sex" label="1">男</el-radio>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="身份号码">
        <el-input v-model="form.id_card"></el-input>
      </el-form-item>
      <el-form-item label="电话">
        <el-input v-model="form.phone"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "Center",
  data() {
    return {
      form: {},
    };
  },
  computed: {
    ...mapState({
      userinfo: (state) => state.userinfo,
    }),
  },
  methods: {
    get_userinfo() {
      this.form = this.userinfo;
    },
  },
  created() {
    this.get_userinfo();
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped></style>
